package littlecyberwar.util;

import java.util.*;

import littlecyberwar.ui.*;

/**
 * This class hold on to all element id --> unit lookup information
 * It's using a HashMap that does not change once the game begins.
 * The lookup key= the elementId, the val=the unit object.
 */
public class ElementIdDictionary {
  private static HashMap dict;

  static {
    dict = new HashMap();
  }

  /**
   * Used to build the unit dictionary when the scenario is
   * initialized.
   */
  public static void put( Integer elementIdIn, Element elementIn ) {
    dict.put(elementIdIn, elementIn);
  }

  /**
   * Used to get the unit
   */
  public static Element get( Integer elementIdIn ) {
    return ( (Element)dict.get(elementIdIn) );
  }
  
  public static Collection getAllUnits() {
  	return ( dict.values());
  }
}